<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ page import="Util.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Buying form</title>
</head>
<body>
	<p>
		You are buying the following book : <b> <%
 %>
		</b>
	</p>
	<p>
		<b> <%
		String isbn = request.getParameter("ISBN");
		String price = request.getParameter("price");

 %>
		</b>
	</p>
	
	<form action="recordPurchase.jsp" method="POST"
		onsubmit="return button1()">
	<p>
		<b> PRICE (EURO): <INPUT type=text name="price" id="price" value="<%out.print(price); %>"
			readonly = "readonly">
		</b>
	</p>
	
	<p>
		<b> ISBN: <INPUT type=text name="isbn" id="isbn" value="<%out.print(isbn); %>"
			readonly = "readonly">
		</b>
	</p>

	<p>--------------------------------------------------</p>

	<p>To complete your purchase, please fill in this form:</p>








		<p>
			Firstname: <INPUT type=text name="firstname" id="firstname">
		</p>
		<p>
			Lastname: <INPUT type=text name="lastname" id="lastname">
		</p>
		<p>
			Street: <INPUT type=text name="Street" id="Street">
		</p>
		<p>
			Number: <INPUT type=text name="Number" id="Number">
		</p>
		<p>
			Box (optional): <INPUT type=text name="Box" id="Box">
		</p>
		<p>
			Zipcode: <INPUT type=text name="zipcode" id="zipcode">
		</p>
		<p>
			City: <INPUT type=text name="city" id="city">
		</p>
		<p>
			Country: <INPUT type=text name="country" id="country">
		</p>

		<INPUT TYPE="submit" VALUE="Validate my purchase">
	</form>




	<SCRIPT LANGUAGE="JavaScript">
	<!--
		function button1() {
			firstname = document.getElementById("firstname").value;
			lastname = document.getElementById("lastname").value;
			street = document.getElementById("Street").value;
			number = document.getElementById("Number").value;
			box = document.getElementById("Box").value;
			zipcode = document.getElementById("zipcode").value;
			city = document.getElementById("city").value;
			country = document.getElementById("country").value;

			if (firstname == '' || lastname == '' || street == ''
					|| number == '' || zipcode == '' || city == ''
					|| country == '') {
				alert("At least one field is not filled!");
				return false;
			} else {
				return true;

			}

		}
	// -->
	</SCRIPT>
</body>
</html>